import { request } from '@/utils/request.js'

/**
 * 打印标签 API JS
 */

export default {

  /**
   * 获取打印标签分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'logistics/printLabel/index',
      method: 'get',
      params
    })
  },

  /**
   * 添加打印标签
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'logistics/printLabel/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新打印标签数据
   * @returns
   */
  update (id, data = {}) {
    return request({
      url: 'logistics/printLabel/update/' + id,
      method: 'put',
      data
    })
  },

  /**
   * 读取打印标签
   * @returns
   */
  read (id) {
    return request({
      url: 'logistics/printLabel/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 将打印标签删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'logistics/printLabel/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 从回收站获取打印标签数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'logistics/printLabel/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复打印标签数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'logistics/printLabel/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除打印标签
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'logistics/printLabel/realDelete',
      method: 'delete',
      data
    })
  },

  /**
   * 更改打印标签数据
   * @returns
   */
  changeStatus (data = {}) {
    return request({
      url: 'logistics/printLabel/changeStatus',
      method: 'put',
      data
    })
  },


  /**
   * 打印标签
   * @returns
   */
  print (data = {}) {
    return request({
      url: 'logistics/printLabel/print',
      method: 'post',
      responseType: 'blob',
      data,
      timeout:120000
    })
  },

  /**
   * 预览标签
   * @returns
   */
  preview (data = {}) {
    return request({
      url: 'logistics/printLabel/preview',
      method: 'post',
      data
    })
  },


}